package test;

import java.util.ArrayList;
import java.util.NoSuchElementException;

import diseaseandcureadministration.disease.DiseaseRegistry;
import diseaseandcureadministration.registry.Registrable;
import diseaseandcureadministration.registry.Registry;

public class DiseaseRegistryRunner 
{
	
	public static void main(String[] args) 
	{
		Registry diseaseRegTest = DiseaseRegistry.getRegistryInstance();
		
		diseaseRegTest.load();
		//diseaseRegTest.save();
		
		System.out.println("test getDisease");
		System.out.println(diseaseRegTest.getElementByName("Asthma").toString());
		System.out.println("Expected: Asthma, s:Coughing, Asphyxiation, c:Astma Spray");
		System.out.println();
		
		try
		{
			diseaseRegTest.getElementByName("Munchausen by proxy");
		}
		catch (NoSuchElementException e)
		{
			System.out.println(e.getMessage());
		}
		System.out.println("Expected: There is no element of that name in the registry");
		System.out.println();
		
		System.out.println("test getAll:");
		ArrayList<Registrable> diseases = diseaseRegTest.getAll();
		for(Registrable disease: diseases)
		{
			System.out.println(disease.toString());
		}
		System.out.println("Expected:");
		System.out.println("Asthma, s:Coughing, Asphyxiation, c:Astma Spray \n" +
							"Pneumonia, s:Coughing, Fever, Dizzyness, c:Penicillin \n" +
							"Stress, s:Dizzyness, Nausea, Hairloss, Dizzyness, c:Weed \n" +
							"Throat Infection, s:Throat Ache, Fever, c:Antibiotics \n" +
							"Blood Infection, s:Dizzyness, Fever, Low Blood Pressure, c:Injected Antibiotics");
		System.out.println();
	}
}
